<%@page import="java.util.List"%>
<%@page import="factory.DaoFactory"%>
<%@page import="bean.Exam"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>考前操作-添加考试</title>
</head>
<body>
	<%@include file="teacher_head.jsp"%>
	<div class="container">
		<div class="row">
			<div class="form-inline">
				<img src="../../resource/teacher.jpg" class="img-rounded imgstyle" />
				<h1>
					<strong>上机考试管理</strong>
				</h1>
			</div>
		</div>
	</div>
	<hr>
	<div class="container divcontainerstyle">
		<h2>添加考试</h2>
		<form action="../../servlet_createexam_teacher" method="post">
			<div class="form-inline">
				<label>考试名称:</label> <input name="examname" type="text"
					placeholder="考试名称*" class="form-control"> <label>考试时间:</label>
				<input name="starttime" type="datetime-local" placeholder="考试时间*"
					class="form-control"> <input name="autostart"
					type="checkbox"> <small>自动开始</small>
				<button type="submit" class="btn btn-primary btn-sm"
					style="display: inline;">添加</button>
			</div>
		</form>
		<hr>
		<table class="table table-striped table-bordered table-hover text-center">
			<thead>
				<tr>
					<td>考试名称</td>
					<td>考试时间</td>
					<td>创建人</td>
					<td>上传试卷</td>
					<td>自动开始</td>
					<td>进行中</td>
					<td>已结束</td>
					<td>已归档</td>
					<td>已清理</td>
					<td>编辑</td>
				</tr>
			</thead>
			<tbody>

				<%
					List<Exam> list = DaoFactory.getExamDaoInstance().queryexam();
					for (Exam exam : list) {
				%>
				<tr>
					<td><%=exam.getExamname()   != null ? exam.getExamname() : ""%></td>
					<td><%=exam.getStarttime()  != null ? exam.getStarttime() : ""%></td>
					<td><%=exam.getExamcreator()!= null ? exam.getExamcreator() : ""%></td>
					<td><%=exam.getExampaper()  != null ? exam.getExampaper() : ""%></td>
					<td><%=exam.getAutostart()  != null ? exam.getAutostart() : ""%></td>
					<td><%=exam.getExamining()  != null ? "√" : ""%></td>
					<td><%=exam.getFinished()   != null ? "√" : ""%></td>
					<td><%=exam.getArchived()   != null ? "√" : ""%></td>
					<td><%=exam.getCleaned()    != null ? "√" : ""%></td>
					<td><a
						href="../../servlet_exammodifysetsession_teacher?id=<%=exam.getExamid()%>&examcreator=<%=exam.getExamcreator()%>&examname=
						<%=exam.getExamname()%>&starttime=<%=exam.getStarttime() %>" id="<%=exam.getExamid()%>"
						class="btn btn-default btn-sm glyphicon glyphicon-pencil" style="<%=exam.getStarted()!=null?"display:none":""%>" ></a> <!-- 根据examid确定考试 -->
						<a href = "../../servlet_deleteexam_teacher?id=<%=exam.getExamid()%>" class="btn btn-default btn-sm glyphicon glyphicon-remove" style="<%=exam.getStarted()!=null?"display:none":""%>"></a>
					</td>
				</tr>
				<%
					}
				%>

			</tbody>
		</table>
	</div>
</body>
</html>